package com.zrm.zfcrpa.applicationListener;

import com.zrm.zfcrpa.dao.mapper.loginMapper.LoginDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class LoginListen {

    @Autowired
    private LoginDao loginDao;

    @Async
    @EventListener
    public void handlerLoginInfo(LoginEvent loginEvent){
        Map<String,String> map = loginEvent.getMap();
        loginDao.addLoginInfo(map.get("ip"),map.get("userName"),map.get("loginType"));
    }
}
